import Vue from 'vue';
import Vuex from 'vuex';

import index from './modules/index';
import admin from './modules/admin';
import theme from './modules/theme';
import modifyPwd from './modules/modifyPwd';
import userInfo from './modules/userInfo';
import userList from './modules/userList';
import login from './modules/login';
// import createPersistedState from 'vuex-persistedstate';

Vue.use(Vuex);

// const vuexPersisted = new createPersistedState({
// 	key: 'loginState',
// 	storage: window.localStorage,
// 	reducer: state => ({
// 		loginState: state.index.loginState
// 	})
// });

const store = new Vuex.Store({
	//strict: true,//是否用vuex的严格模式

	/**
	 * [modules 注意：使用modules一定不要在前面设置]
	 * @type {Object}
	 * state: '',getters: '',mutations: '',actions: '',
	 */
	modules: {
		// namespaced: true,
		index,
		admin,
		theme,
		modifyPwd,
		userInfo,
		userList,
		login,
	}
	// plugins: [vuexPersisted]
});
export default store;